<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    <link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.ico">
    <title>Preclinic - Medical & Hospital - Bootstrap 4 Admin Template</title>
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <!--[if lt IE 9]>
		<script src="assets/js/html5shiv.min.js"></script>
		<script src="assets/js/respond.min.js"></script>
	<![endif]-->
</head>

<body>
    <div class="main-wrapper">
        <div class="page-wrapper" style="padding-top: 0px;">
            <div class="content">
                <div class="row">
                    <div class="col-sm-8 col-5">
                        <h4 class="page-title">请假类型</h4>
                    </div>
                    <div class="col-sm-4 col-7 text-right m-b-30">
                        <a href="add-leave-type.html" class="btn btn-primary btn-rounded float-right"><i class="fa fa-plus"></i> 新增请假类型</a>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="table-responsive">
                            <table class="table table-striped custom-table">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>请假类型</th>
                                        <th>允许天数</th>
                                        <th>状态</th>
                                        <th class="text-right">操作</th>
                                    </tr>
                                </thead>
                                <tbody id="leaveTypes">                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
		<div id="delete_leavetype" class="modal fade delete-modal" role="dialog">
			<div class="modal-dialog modal-dialog-centered">
				<div class="modal-content">
					<div class="modal-body text-center">
						<h3>Are you sure want to delete this Leave Type?</h3>
						<div class="m-t-20"> <a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
							<button type="submit" class="btn btn-danger">Delete</button>
						</div>
					</div>
				</div>
			</div>
		</div>
    </div>
    <div class="sidebar-overlay" data-reff=""></div>
    <script src="assets/js/jquery-3.2.1.min.js"></script>
	<script src="assets/js/popper.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.slimscroll.js"></script>
    <script src="assets/js/app.js"></script>
	<!--json data-->
	<script type="text/javascript" src="json/leaveTypes.json"></script>
	<script type="text/javascript">
	$(document).ready(function () {	
		var leaveTypesStr = "";
		for(var i = 0; i < leaveTypes.length; i++){
			leaveTypesStr = leaveTypesStr + '<tr>';
            leaveTypesStr = leaveTypesStr + '<td>' + (i + 1) + '</td>';
            leaveTypesStr = leaveTypesStr + '<td>'+ leaveTypes[i].leaveType +'</td>';
            leaveTypesStr = leaveTypesStr + '<td>'+ leaveTypes[i].leaveDays +'</td>';
            leaveTypesStr = leaveTypesStr + '<td>';
            leaveTypesStr = leaveTypesStr + '<div class="dropdown action-label">';
            leaveTypesStr = leaveTypesStr + '<a class="custom-badge ';
			if(leaveTypes[i].status == "启用"){
				leaveTypesStr = leaveTypesStr + 'status-green';
			}else{
				leaveTypesStr = leaveTypesStr + 'status-red';
			}
			leaveTypesStr = leaveTypesStr + ' dropdown-toggle" href="#" data-toggle="dropdown" aria-expanded="false">'+ leaveTypes[i].status +'</a>';
            leaveTypesStr = leaveTypesStr + '<div class="dropdown-menu dropdown-menu-right">';
            leaveTypesStr = leaveTypesStr + '<a href="#" class="dropdown-item">启用</a>';
            leaveTypesStr = leaveTypesStr + '<a href="#" class="dropdown-item">禁用</a>';
            leaveTypesStr = leaveTypesStr + '</div>';
            leaveTypesStr = leaveTypesStr + '</div>';
            leaveTypesStr = leaveTypesStr + '</td>';
            leaveTypesStr = leaveTypesStr + '<td class="text-right">';
            leaveTypesStr = leaveTypesStr + '<div class="dropdown dropdown-action">';
            leaveTypesStr = leaveTypesStr + '<a href="#" class="action-icon dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-ellipsis-v"></i></a>';
            leaveTypesStr = leaveTypesStr + '<div class="dropdown-menu dropdown-menu-right">';
            leaveTypesStr = leaveTypesStr + '<a class="dropdown-item" href="edit-leave-type.html"><i class="fa fa-pencil m-r-5"></i> 编辑</a>';
            leaveTypesStr = leaveTypesStr + '<a class="dropdown-item" href="#" data-toggle="modal" data-target="#delete_leavetype"><i class="fa fa-trash-o m-r-5"></i> 删除</a>';
            leaveTypesStr = leaveTypesStr + '</div>';
            leaveTypesStr = leaveTypesStr + '</div>';
            leaveTypesStr = leaveTypesStr + '</td>';
            leaveTypesStr = leaveTypesStr + '</tr>';
		}
		$("#leaveTypes").html(leaveTypesStr);
	});
	</script>
</body>

</html>